# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
#     https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
#     https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane

default_platform(:ios)

platform :ios do
  before_all do         #在执行每个lane之前都会先执行
    cocoapods
  end
  lane :beta do |params|
    #打包的ipa存放路径
    outputDir = "./fastlane/build"
    #打包的ipa名称
    outputName = params[:outputName]
    if outputName.nil?
       UI.user_error!("You have to provide a output name")
    end
    build_app(
      configuration: "Release",
      silent: true,
      clean: true,
      output_directory: "#{outputDir}",
      output_name: "#{outputName}",
      export_method: "ad-hoc"
    )
    pgyer(
      api_key: "8cc1b9e3cdce02abe9549746abd5b5d6",
      password: "123456",
      install_type: "2",
      ipa: "#{outputDir}/#{outputName}.ipa"
    )
  end
end
